<div class='container'>
  <div class='contents clearfix'>

    {{view.logoHTML}}

    {{#if showExtraInfo}}
      <div class="extra-info-wrapper">
        <div class="extra-info">
          {{#if showFavoriteButton}}
            <a {{bindAttr class=":star topic.starred:starred"}} {{action toggleStar}} href='#' {{bindAttr title="topic.favoriteTooltip"}}></a>
          {{/if}}
          <h1>
          {{#if topic.details.loaded}}
            {{topicStatus topic=topic}}
            <a class='topic-link' href='{{unbound topic.url}}'>{{{topic.fancy_title}}}</a>
          {{else}}
            {{#if topic.errorLoading}}
              {{topic.errorTitle}}
            {{else}}
              {{i18n topic.loading}}
            {{/if}}
          {{/if}}
          {{boundCategoryLink topic.category}}
          </h1>
        </div>
      </div>
    {{/if}}

    <div class='panel clearfix'>
      {{#unless showExtraInfo}}
        <div class='current-username'>
          {{#if currentUser}}
          <span class='username'><a {{bindAttr href="currentUser.path"}}>{{currentUser.name}}</a></span>
          {{else}}
            <button {{action showLogin}} class='btn btn-primary btn-small'>{{i18n log_in}}</button>
          {{/if}}
        </div>
      {{/unless}}
      <ul class='icons clearfix'>
        <li class='notifications'>
          {{#if currentUser}}
            <a class='icon' href="#" {{action showNotifications target="view"}} data-notifications="notifications-dropdown" id='user-notifications' title='{{i18n notifications.title}}'><i class='icon-comment'></i></a>
            {{#if currentUser.unread_notifications}}
              <a href='#' class='badge-notification unread-notifications'>{{currentUser.unread_notifications}}</a>
            {{/if}}
            {{#if currentUser.unread_private_messages}}
              <a href='#' class='badge-notification unread-private-messages'>{{currentUser.unread_private_messages}}</a>
            {{/if}}
          {{else}}
            <a class='icon' href="#" {{action showLogin}} title='{{i18n notifications.title}}'><i class='icon-comment'></i></a>
          {{/if}}
        </li>
        <li>
          {{#if Discourse.loginRequired}}
            <a class='icon expand' href='#' {{action showLogin}}>
              <i class='icon-search'></i>
            </a>
          {{else}}
            <a class='icon expand'
               href='#'
               data-dropdown="search-dropdown"
               title='{{i18n search.title}}'>
               <i class='icon-search'></i>
            </a>
          {{/if}}
        </li>
        <li class='categories dropdown'>
          {{#if Discourse.loginRequired}}
            <a class='icon'
               href="#"
               {{action showLogin}}>
               <i class='icon-reorder'></i>
            </a>
          {{else}}
            <a class='icon'
               data-dropdown="site-map-dropdown"
               href="#"
               title='{{i18n site_map}}'>
               <i class='icon-reorder'></i>
            </a>
          {{/if}}
          {{#if currentUser.site_flagged_posts_count}}
            <a href='/admin/flags/active' title='{{i18n notifications.total_flagged}}' class='badge-notification flagged-posts'>{{currentUser.site_flagged_posts_count}}</a>
          {{/if}}
        </li>
        <li class='current-user'>
          {{#if currentUser}}
            {{#linkTo 'userActivity.index' currentUser titleKey="current_user" class="icon"}}{{avatar currentUser imageSize="medium" }}{{/linkTo}}
          {{else}}
            <div class="icon not-logged-in-avatar" {{action showLogin}}><i class='icon-user'></i></div>
          {{/if}}
        </li>
      </ul>

      {{render search}}

      <section class='d-dropdown' id='notifications-dropdown'>
        {{#if view.notifications}}
          <ul>
            {{#each view.notifications}}
            <li class="{{unbound readClass}}">{{{unbound rendered}}}</li>
            {{/each}}
            <li class='read last'>
              <a {{bindAttr href="currentUser.path"}}>{{i18n notifications.more}} &hellip;</a>
            </li>
          </ul>
        {{else}}
          <div class='none'>{{i18n notifications.none}}</div>
        {{/if}}
      </section>

      <section class='d-dropdown' id='site-map-dropdown'>
      <ul class="location-links">
        {{#if currentUser.staff}}
          <li><a href="/admin"><i class='icon icon-wrench'></i>{{i18n admin_title}}</a></li>
          <li><a href="/admin/flags/active"><i class='icon icon-flag'></i>{{i18n flags_title}}</a>
          {{#if currentUser.site_flagged_posts_count}}
            <a href='/admin/flags/active' title='{{i18n notifications.total_flagged}}' class='badge-notification flagged-posts'>{{currentUser.site_flagged_posts_count}}</a>
          {{/if}}
          </li>
        {{/if}}
        <li>
          {{#titledLinkTo "list.latest" titleKey="filters.latest.help"}}{{i18n filters.latest.title}}{{/titledLinkTo}}
        </li>
        <li>{{faqLink}}</li>
      </ul>

      {{#if categories}}
        <ul class="category-links">
          <li class='heading' title="{{i18n filters.categories.help}}">
            {{#linkTo "list.categories"}}{{i18n filters.categories.title}}{{/linkTo}}
          </li>

          {{#each categories}}
            <li class='category'>
              {{categoryLink this}}
              <b>{{unbound topic_count}}</b></a>
            </li>
          {{/each}}
        </ul>
      {{/if}}

    </section>

    </div>
  </div>
</div>


